#ifdef USE_HOOKS

#ifndef UPDATER_HOOKS_H
#define UPDATER_HOOKS_H
/*

	2004.10.18
	Mountaniol Vsevolod.
	Definitions for hooks.

*/

#include "updater.h"


/*  Every hook it is chain of functions.
    Every such function receive ucore struct and return a status. */

/* HOOK statuses */    

#define HOOK_OK         (0)     /* If first bit is 0 it means that updater can continue. */
#define HOOK_STOP       (1)     /* First bit 1 - stop the updater, an critical error */
#define HOOK_WARNING    (1<<1)  /* Second bit up means that hook send a warning */
#define HOOK_CROSS      (1<<2)  /* This bit means: I copied the buffer from IN to OUT - now cross the buffers. */

/* Prototype of hook function */
typedef INT(*hookfunc_t)(ucore_t *);

/* Chain of hooks */
struct hookchain_struct 
{
    struct hookchain_struct * next;  /* next hook in the chain   */
    hookfunc_t h;                 /* Pointer to function      */
    INT priority;               /* The fucnction priority   */
};

typedef struct hookchain_struct hookchain_t;


/* On initialisation updater ask from module which hooks it provides. */
/* The module return an array of hook_description, where last member zeroed. */
/* The function which will be searched in module is module_init() */
struct hook_description 
{
    CHAR name[256];     /* Name of function */
    INT flags;          /* XXX Flags define how the hook must be installed. */
    INT type;           /* Type of the hook. Tepe is enum_hook_t */
    INT priority;       /* Hook priority, 1-255. If priority is 0 it means: "no matter" */
};

typedef struct hook_description hook_description_t;

/* This function initiates hooks: opens shared libs, get list of functions etc. */
INT InitHooks(ucore_t * ps_ucore);


#endif /* UPDATER_HOOKS_H */

#endif /* USE_HOOKS */


